/*
 *  backend_i.h
 *  kangmodb
 *
 *  Created by 강모 김 on 11. 2. 28..
 *  Copyright 2011 강모소프트. All rights reserved.
 *
 */

/* connection open */


/* exec stmt */


/* connection close */


/* btree open */


/* trans begin */
OP_Transaction in vbde.c
  sqlite3BtreeBeginTrans


/* stmt begin */

/* stmt end */



/* trans rollback */
sqlite3BtreeClose in btree.c
  sqlite3BtreeRollback

/* savepoint */


/* trans commit */
sqlite3BtreeCommit in btree.c
  sqlite3BtreeCommitPhaseOne
  sqlite3BtreeCommitPhaseTwo

sqlite3VdbeExec
OP_Halt:
  sqlite3VdbeHalt
    vdbeCommit in vbdeaux.c
    for all db 
      sqlite3BtreeCommitPhaseOne
        syncJournal
        pager_write_pagelist
		sqlite3PcacheCleanAll /* clear all dirty pages */
        sqlite3PagerSync /* fsync */
    for all db 
      sqlite3BtreeCommitPhaseTwo
        pager_end_transaction
		  releaseAllSavepoints /*Free all structures in the Pager.aSavepoint[] array*/
		  sqlite3OsDelete(pPager->zJournal/*"testdb-journal"*/)


/* list of files to examine */
ctime.c - compile time options
backup.c - P2
bitvec.c - 
** an object that represents a fixed-length bitmap.
** A bitmap is used to record which pages of a database file have been
** journalled during a transaction, or which pages have the "dont-write"
** property.

btmutex.c
** This file contains code used to implement mutexes on Btree objects
?SQLITE_OMIT_SHARED_CACHE

btree.c
pager.c
** This is the implementation of the page cache subsystem or "pager".
** 
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.

pcache.c
** This file implements that page cache.

pcache1.c
** This file implements the default page cache implementation (the
** sqlite3_pcache interface). It also contains part of the implementation
** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features.
** If the default page cache implementation is overriden, then neither of
** these two features are available.

journal.c
SQLITE_ENABLE_ATOMIC_WRITE

?SQLITE_OMIT_INCRBLOB

SQLITE_OMIT_ATTACH
SQLITE_OMIT_AUTHORIZATION

main.c
sqlite3_wal_checkpoint_v2
sqlite3_wal_checkpoint
sqlite3Checkpoint
** Run a checkpoint on database iDb. This is a no-op if database iDb is
** not currently open in WAL mode.

SQLITE_OPEN_DELETEONCLOSE |
SQLITE_OPEN_EXCLUSIVE |
SQLITE_OPEN_MAIN_DB |
SQLITE_OPEN_TEMP_DB | 
SQLITE_OPEN_TRANSIENT_DB | 
SQLITE_OPEN_MAIN_JOURNAL | 
SQLITE_OPEN_TEMP_JOURNAL | 
SQLITE_OPEN_SUBJOURNAL | 
SQLITE_OPEN_MASTER_JOURNAL |
SQLITE_OPEN_NOMUTEX |
SQLITE_OPEN_FULLMUTEX |
SQLITE_OPEN_WAL
SQLITE_OPEN_SHAREDCACHE
SQLITE_OPEN_PRIVATECACHE
SQLITE_OPEN_NOMUTEX
SQLITE_OPEN_FULLMUTEX


SQLITE_ENABLE_RTREE
?SQLITE_ENABLE_FTS3
?SQLITE_ENABLE_ICU

?SQLITE_ENABLE_COLUMN_METADATA
?SQLITE_OMIT_VIRTUALTABLE

prepare.c (p2)
** This file contains the implementation of the sqlite3_prepare()
** interface, and routines that contribute to loading the database schema
** from disk.

wal.c (remove!)
** This file contains the implementation of a write-ahead log (WAL) used in 
** "journal_mode=WAL" mode.

unknown :
icu
module 
can a transaction span across multiple B-trees?

/* Substitute backend interface names to unused ones 
   This file will be included in original SQLite source codes to make backend implementation unused at all.
   To find out where these functions are used, you can search vbde.c with the specified OpCode 
 */
/* OpCode : OP_Column */
sqlite3VdbeCursorMoveto
sqlite3BtreeCursorIsValid
sqlite3BtreeKeySize
sqlite3BtreeDataSize
sqlite3BtreeKeyFetch
sqlite3BtreeDataFetch
sqlite3VdbeMemFromBtree

/* OpCode : OP_Count */
sqlite3BtreeCount
//checkSavepointCount
sqlite3BtreeSavepoint
//sqlite3ExpirePreparedStatements
//sqlite3ResetInternalSchema
//sqlite3DbFree

/* OpCode : OP_AutoCommit */
sqlite3RollbackAll
//if this is just about managing savepoints in memory, no need to implement this in the backend.
//sqlite3CloseSavepoints

/* OpCode : OP_Transaction */
sqlite3BtreeBeginTrans
sqlite3BtreeIsInTrans
sqlite3BtreeBeginStmt

/* OpCode : OP_ReadCookie, OP_VerifyCookie */
sqlite3BtreeGetMeta

/* OpCode : OP_SetCookie */
sqlite3BtreeUpdateMeta
//sqlite3ExpirePreparedStatements

/* OpCode : OP_VerifyCookie */
sqlite3ResetInternalSchema

/* OpCode : OP_OpenRead, OP_OpenWrite */
VdbeCursor
Btree
//allocateCursor
sqlite3BtreeCursor

/* OpCode : OP_OpenAutoindex, OP_OpenEphemeral */
// used allocateCursor
sqlite3BtreeOpen
sqlite3BtreeCreateTable
sqlite3BtreeCursor

/* OpCode : OP_Close */
//sqlite3VdbeFreeCursor

/* OpCode : OP_SeekLt, OP_SeekLe, OP_SeekGe, OP_SeekGt */
//UnpackedRecord
sqlite3BtreeFirst
sqlite3BtreeLast
sqlite3BtreeMovetoUnpacked
sqlite3BtreePrevious
sqlite3BtreeEof

/* OpCode : OP_NotFound, OP_Found */
//sqlite3VdbeRecordUnpack
//sqlite3VdbeDeleteUnpackedRecord

/* OpCode : OP_IsUnique */
// used sqlite3BtreeMovetoUnpacked
//BtCursor
sqlite3BtreeGetCachedRowid
//sqlite3BtreeLast
sqlite3BtreeCursorIsValid
//used sqlite3BtreeKeySize

/* OpCode : OP_Insert, OP_InsertInt */
sqlite3BtreeSetCachedRowid
sqlite3BtreeInsert

/* OpCode : OP_Delete */
sqlite3VdbeCursorMoveto
//used sqlite3BtreeSetCachedRowid
sqlite3BtreeDelete

/* OpCode : Op_ResetCount */
sqlite3VdbeSetChanges

/* OpCode : OP_RowKey, OP_RowData */
//used sqlite3BtreeCursorIsValid
//used sqlite3VdbeCursorMoveto
//used sqlite3BtreeKeySize
//used sqlite3BtreeDataSize
sqlite3BtreeKey
sqlite3BtreeData

/* OpCode : OP_Rowid */
sqlite3VdbeCursorMoveto
//used sqlite3BtreeKeySize

/* OpCode : OP_NullRow */
sqlite3BtreeClearCursor

/* OpCode : OP_Last */
//used sqlite3BtreeLast

/* OpCode : OP_Prev, OP_Next */
sqlite3BtreeNext
sqlite3BtreePrevious

/* OpCode : OP_IdxInsert */
sqlite3BtreeInsert

/* OpCode : OP_IdxDelete */
//used sqlite3BtreeMovetoUnpacked
sqlite3BtreeDelete

/* OP_IdxRowid */
//used sqlite3VdbeCursorMoveto
sqlite3VdbeIdxRowid

/* OpCode : OP_IdxLT, OP_IdxGE */
?sqlite3VdbeIdxKeyCompare

/* OpCode : OP_Destroy */
sqlite3BtreeDropTable
sqlite3RootPageMoved

/* OpCode : OP_Clear */
sqlite3BtreeClearTable

/* OpCode : OP_CreateIndex, OP_CreateTable */
sqlite3BtreeCreateTable

/* OpCode : OP_ParseSchema */
sqlite3BtreeHoldsMutex
sqlite3BtreeEnterAll
?sqlite3BtreeEnterAll
?sqlite3DbFree

/* OpCode : OP_LoadAnalysis */
sqlite3AnalysisLoad

/* OpCode : OP_DropTable, OP_DropIndex, OP_DropTrigger */
sqlite3UnlinkAndDeleteTable

/* OpCode : OP_IntegrityCk */
sqlite3BtreeIntegrityCheck

/* OpCode : OP_RowSetAdd */
sqlite3RowSetInsert

/* OpCode : OP_RowSetTest */
?sqlite3RowSetTest
?sqlite3RowSetInsert

/* OpCode : OP_Checkpoint */
?sqlite3Checkpoint

SQLITE_OMIT_TRIGGER
SQLITE_OMIT_FOREIGN_KEY
SQLITE_OMIT_AUTOINCREMENT
SQLITE_OMIT_PRAGMA

/* OpCode : OP_Vacuum */
sqlite3RunVacuum


?SQLITE_OMIT_VACUUM
?SQLITE_OMIT_ATTACH
?SQLITE_OMIT_AUTOVACUUM
/* OpCode : OP_IncrVacuum */
sqlite3BtreeIncrVacuum

/* OpCode : OP_Expire */
//used sqlite3ExpirePreparedStatements

/* OpCode : OP_TableLock */
sqlite3BtreeLockTable

SQLITE_OMIT_VIRTUALTABLE?

/* OpCode : OP_MaxPgcnt */
SQLITE_OMIT_PAGER_PRAGMAS
sqlite3BtreeMaxPageCount


/* From bree.c */
SQLITE_OMIT_SHARED_CACHE


/**************************************************
 files using sqlite3Pager....
# backup.c:   if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){
# backup.c:   if( nSrcPgsz!=nDestPgsz && sqlite3PagerGetCodec(pDestPager)!=0 ){
# backup.c:     if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg))
# backup.c:      && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg))
# backup.c:       u8 *zDestData = sqlite3PagerGetData(pDestPg);
# backup.c:       ((u8 *)sqlite3PagerGetExtra(pDestPg))[0] = 0;
# backup.c:     sqlite3PagerUnref(pDestPg);
# backup.c:   pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
# backup.c:     destMode = sqlite3PagerGetJournalMode(sqlite3BtreePager(p->pDest));
# backup.c:         rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);
# backup.c:           rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg));
# backup.c:           sqlite3PagerUnref(pSrcPg);
# backup.c:       ** sqlite3PagerTruncateImage() here so that any pages in the 
# backup.c:       sqlite3PagerTruncateImage(pDestPager, nDestTruncate);
# backup.c:         sqlite3_file * const pFile = sqlite3PagerFile(pDestPager);
# backup.c:         rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1);
# backup.c:           rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);
# backup.c:             u8 *zData = sqlite3PagerGetData(pSrcPg);
# backup.c:           sqlite3PagerUnref(pSrcPg);
# backup.c:           rc = sqlite3PagerSync(pDestPager);
# backup.c:         rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0);
# backup.c:     pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
_ main.c:   sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
? main.c:       fd = sqlite3PagerFile(pPager);
_ pragma.c:           sqlite3PagerLockingMode(pPager, eMode);
_ pragma.c:       eMode = sqlite3PagerLockingMode(pPager, eMode);
_ pragma.c:     iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit);
? pragma.c:       sqlite3_file *pFile = sqlite3PagerFile(pPager);
? pragma.c:       sqlite3_file *pFile = sqlite3PagerFile(pPager);
_ status.c:           totalUsed += sqlite3PagerMemUsed(pPager);
_ vacuum.c:   isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain));
# vacuum.c:   if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))
_? vdbe.c:   eOld = sqlite3PagerGetJournalMode(pPager);
_? vdbe.c:   if( !sqlite3PagerOkToChangeJournalMode(pPager) ) eNew = eOld;
? vdbe.c:   zFilename = sqlite3PagerFilename(pPager);
_? vdbe.c:        || !sqlite3PagerWalSupported(pPager))   /* No shared-memory support 
_? vdbe.c:         rc = sqlite3PagerCloseWal(pPager);
_? vdbe.c:           sqlite3PagerSetJournalMode(pPager, eNew);
_? vdbe.c:         sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);
_? vdbe.c:   eNew = sqlite3PagerSetJournalMode(pPager, eNew);
? vdbeapi.c:       int nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt));
_? vdbeaux.c:       rc = sqlite3PagerExclusiveLock(sqlite3BtreePager(pBt));
#? wal.c:     if( (pData = sqlite3PagerCodec(p))==0 ) return SQLITE_NOMEM;
#? wal.c:       if( (pData = sqlite3PagerCodec(pLast))==0 ) return SQLITE_NOMEM;
_ attach.c:     sqlite3PagerLockingMode(pPager, db->dfltLockMode);


 /**************************************************
 files using sqlite3Pcache....
_ main.c:   ** call to sqlite3PcacheInitialize().
_ main.c:       rc = sqlite3PcacheInitialize();
_ main.c:       sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, 
_ main.c:     sqlite3PcacheShutdown();
_ main.c:         sqlite3PCacheSetDefault();
_? malloc.c:   return sqlite3PcacheReleaseMemory(n);
 ** below ones will be removed, because  1) pager owns pcache, but pager will be removed. 2) pcache1.c defines pcache itself, which will be removed. 
 pager.c:       assert( sqlite3PcacheRefCount(pPager->pPCache)==0 || pPager->tempFile );
 pager.c:       assert( sqlite3PcacheRefCount(pPager->pPCache)>0 );
 pager.c:   (void)sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &p);
 pager.c:   sqlite3PcacheClear(pPager->pPCache);
 pager.c:   sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash);
 pager.c:   if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){
 pager.c:   sqlite3PcacheCleanAll(pPager->pPCache);
 pager.c:   sqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize);
 pager.c:     sqlite3PcacheMakeDirty(pPg);
 pager.c:       sqlite3PcacheMakeClean(pPg);
 pager.c:     sqlite3PcacheRelease(pPg);
 pager.c:     if( sqlite3PcachePageRefcount(pPg)==1 ){
 pager.c:       sqlite3PcacheDrop(pPg);
 pager.c:   pList = sqlite3PcacheDirtyList(pPager->pPCache);
 pager.c:         testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );
 pager.c:   sqlite3PcacheSetCachesize(pPager->pPCache, mxPage);
 pager.c:    && sqlite3PcacheRefCount(pPager->pPCache)==0 
 pager.c:       sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);
 pager.c:   sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb);
 pager.c:   sqlite3PcacheClose(pPager->pPCache);
 pager.c:   sqlite3PcacheRef(pPg);
 pager.c:   sqlite3PcacheClearSyncFlags(pPager->pPCache);
 pager.c: ** If successful, sqlite3PcacheMakeClean() is called on the page and
 pager.c: ** is returned by sqlite3PcacheMakeClean() is not called.
 pager.c:   ** is impossible for sqlite3PCacheFetch() to be called with createFlag==1
 pager.c:     sqlite3PcacheMakeClean(pPg);
 pager.c:   int pcacheSize = sqlite3PcacheSize();       /* Bytes to allocate for PCache 
 pager.c:   **     PCache object                   (sqlite3PcacheSize() bytes)
 pager.c:   sqlite3PcacheOpen(szPageDflt, nExtra, !memDb,
 pager.c:   assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );
 pager.c:      && (pPager->pBackup || sqlite3PcachePagecount(pPager->pPCache)>0) 
 pager.c:   if( (sqlite3PcacheRefCount(pPager->pPCache)==0) ){
 pager.c:     rc = sqlite3PcacheFetch(pPager->pPCache, pgno, 1, ppPage);
 pager.c:     // Either the call to sqlite3PcacheFetch() returned an error or the
 pager.c:     sqlite3PcacheDrop(pPg);
 pager.c:   sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg);
 pager.c:     sqlite3PcacheRelease(pPg);
 pager.c:   ** This is done before calling sqlite3PcacheMakeDirty() on the page. 
 pager.c:   ** Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then
 pager.c:   sqlite3PcacheMakeDirty(pPg);
 pager.c:       PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
 pager.c:         sqlite3PcacheCleanAll(pPager->pPCache);
 pager.c:        && (0==(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty)
 pager.c:       rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache));
 pager.c:       sqlite3PcacheCleanAll(pPager->pPCache);
 pager.c:   return sqlite3PcacheRefCount(pPager->pPCache);
 pager.c:   return perPageSize*sqlite3PcachePagecount(pPager->pPCache)
 pager.c:   return sqlite3PcachePageRefcount(pPage);
 pager.c:   a[0] = sqlite3PcacheRefCount(pPager->pPCache);
 pager.c:   a[1] = sqlite3PcachePagecount(pPager->pPCache);
 pager.c:   a[2] = sqlite3PcacheGetCachesize(pPager->pPCache);
 pager.c:       sqlite3PcacheMove(pPgOld, pPager->dbSize+1);
 pager.c:       sqlite3PcacheDrop(pPgOld);
 pager.c:   sqlite3PcacheMove(pPg, pgno);
 pager.c:   sqlite3PcacheMakeDirty(pPg);
 pager.c:     sqlite3PcacheMove(pPgOld, origPgno);
 pager.c:     sqlite3PcacheMakeDirty(pPgHdr);
 pcache1.c: void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){
 pcache1.c: void sqlite3PCacheSetDefault(void){
 pcache1.c: int sqlite3PcacheReleaseMemory(int nReq){
 pcache1.c: void sqlite3PcacheStats(


 /**************************************************
 files using sqlite3Btree....
# backup.c:   rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);
# backup.c:   rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);
# backup.c:   Pager * const pDestPager = sqlite3BtreePager(p->pDest);
# backup.c:   const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc);
# backup.c:   int nDestPgsz = sqlite3BtreeGetPageSize(p->pDest);
# backup.c:   assert( sqlite3BtreeHoldsMutex(p->pSrc) );
# backup.c:   pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
# backup.c:   sqlite3BtreeEnter(p->pSrc);
# backup.c:     Pager * const pSrcPager = sqlite3BtreePager(p->pSrc);     /* Source pager 
# backup.c:     Pager * const pDestPager = sqlite3BtreePager(p->pDest);   /* Dest pager 
# backup.c:      && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2)) 
# backup.c:       sqlite3BtreeGetMeta(p->pDest, BTREE_SCHEMA_VERSION, &p->iDestSchema);
# backup.c:     if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){
# backup.c:       rc = sqlite3BtreeBeginTrans(p->pSrc, 0);
# backup.c:     pgszSrc = sqlite3BtreeGetPageSize(p->pSrc);
# backup.c:     pgszDest = sqlite3BtreeGetPageSize(p->pDest);
# backup.c:     destMode = sqlite3PagerGetJournalMode(sqlite3BtreePager(p->pDest));
# backup.c:     nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc);
# backup.c:      && (rc = sqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1))==SQLITE_OK
# backup.c:       assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) );
# backup.c:       assert( pgszDest==sqlite3BtreeGetPageSize(p->pDest) );
# backup.c:        && SQLITE_OK==(rc = sqlite3BtreeCommitPhaseTwo(p->pDest))
# backup.c:       TESTONLY( rc2  = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0);
# backup.c:       TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc);
# backup.c:   sqlite3BtreeLeave(p->pSrc);
# backup.c:   sqlite3BtreeEnter(p->pSrc);
# backup.c:     pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
# backup.c:   sqlite3BtreeRollback(p->pDest);
# backup.c:   sqlite3BtreeLeave(p->pSrc);
# backup.c: int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
# backup.c:   sqlite3BtreeEnter(pTo);
# backup.c:   sqlite3BtreeEnter(pFrom);
# backup.c:   sqlite3BtreeLeave(pFrom);
# backup.c:   sqlite3BtreeLeave(pTo); 
_? build.c:     sqlite3BtreeEnterAll(db);
_? build.c:       assert(i==1 || (pDb->pBt && sqlite3BtreeHoldsMutex(pDb->pBt)));
_? build.c:   sqlite3BtreeLeaveAll(db);
_ build.c:     rc = sqlite3BtreeOpen(0, db, &pBt, 0, flags);
_ build.c:     if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){
? callback.c:     p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaFree);
_ main.c:     if( pBt && sqlite3BtreeIsInBackup(pBt) ){
_ main.c:       sqlite3BtreeClose(pDb->pBt);
_ main.c:       if( sqlite3BtreeIsInTrans(db->aDb[i].pBt) ){
_ main.c:       sqlite3BtreeRollback(db->aDb[i].pBt);
_? main.c:       rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt, eMode, pnLog, pnCkpt);
_ main.c:   rc = sqlite3BtreeOpen(zFilename, db, &db->aDb[0].pBt, 0,
_ main.c:   sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
_ main.c:   sqlite3BtreeEnterAll(db);
_ main.c:   sqlite3BtreeLeaveAll(db);
_ main.c:       sqlite3BtreeEnter(pBtree);
_ main.c:       pPager = sqlite3BtreePager(pBtree);
_ main.c:       sqlite3BtreeLeave(pBtree);
_ main.c:       sqlite3BtreeSetPageSize(db->aDb[0].pBt, 0, x, 0);
_ pragma.c:     if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){
_ pragma.c:     sqlite3BtreeClose(db->aDb[1].pBt);
_ pragma.c:       sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
_ pragma.c:       int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;
_ pragma.c:       if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){
? pragma.c:         sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);
? pragma.c:     b = sqlite3BtreeSecureDelete(pBt, b);
_ pragma.c:           pPager = sqlite3BtreePager(db->aDb[ii].pBt);
_ pragma.c:       pPager = sqlite3BtreePager(pDb->pBt);
_ pragma.c:     Pager *pPager = sqlite3BtreePager(pDb->pBt);
_ pragma.c:          auto_vacuum = sqlite3BtreeGetAutoVacuum(pBt);
_ pragma.c:         int rc = sqlite3BtreeSetAutoVacuum(pBt, eAuto);
_ pragma.c:       sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
_ pragma.c:       Pager *pPager = sqlite3BtreePager(pDb->pBt);
_ pragma.c:       Pager *pPager = sqlite3BtreePager(pDb->pBt);
? pragma.c:            sqlite3BtreeGetFilename(db->aDb[i].pBt), 0);
_ pragma.c:       if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){
? pragma.c:     sqlite3BtreeSetSafetyLevel(pDb->pBt, pDb->safety_level,
_ prepare.c:   assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );
_ prepare.c:   sqlite3BtreeEnter(pDb->pBt);
_ prepare.c:   if( !sqlite3BtreeIsInReadTrans(pDb->pBt) ){
_ prepare.c:     rc = sqlite3BtreeBeginTrans(pDb->pBt, 0);
_ prepare.c:     sqlite3BtreeGetMeta(pDb->pBt, i+1, (u32 *)&meta[i]);
_ prepare.c:     sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
_ prepare.c:     sqlite3BtreeCommit(pDb->pBt);
_ prepare.c:   sqlite3BtreeLeave(pDb->pBt);
_ prepare.c:     if( !sqlite3BtreeIsInReadTrans(pBt) ){
_ prepare.c:       rc = sqlite3BtreeBeginTrans(pBt, 0);
_ prepare.c:     sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&cookie);
_ prepare.c:       sqlite3BtreeCommit(pBt);
_ prepare.c:       assert( sqlite3BtreeHoldsMutex(pBt) );
? prepare.c:       rc = sqlite3BtreeSchemaLocked(pBt);
_ prepare.c:   sqlite3BtreeEnterAll(db);
_ prepare.c:   sqlite3BtreeLeaveAll(db);
_ status.c:       sqlite3BtreeEnterAll(db);
_ status.c:           Pager *pPager = sqlite3BtreePager(pBt);
_ status.c:       sqlite3BtreeLeaveAll(db);
# vacuum.c:   isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain));
# vacuum.c:   ** sqlite3BtreeCopyFile() is called.
# vacuum.c:   sqlite3BtreeCommit(pTemp);
# vacuum.c:   nRes = sqlite3BtreeGetReserve(pMain);
# vacuum.c:   if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))
# vacuum.c:   if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0)
# vacuum.c:   if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0)
# vacuum.c:    || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))
# vacuum.c:   sqlite3BtreeSetAutoVacuum(pTemp, db->nextAutovac>=0 ? db->nextAutovac :
# vacuum.c:                                            sqlite3BtreeGetAutoVacuum(pMain));
# vacuum.c:   ** call to sqlite3BtreeCopyFile(). The main database btree level
# vacuum.c:     assert( 1==sqlite3BtreeIsInTrans(pTemp) );
# vacuum.c:     assert( 1==sqlite3BtreeIsInTrans(pMain) );
# vacuum.c:       sqlite3BtreeGetMeta(pMain, aCopy[i], &meta);
# vacuum.c:       rc = sqlite3BtreeUpdateMeta(pTemp, aCopy[i], meta+aCopy[i+1]);
# vacuum.c:     rc = sqlite3BtreeCopyFile(pMain, pTemp);
# vacuum.c:     rc = sqlite3BtreeCommit(pTemp);
# vacuum.c:     sqlite3BtreeSetAutoVacuum(pMain, sqlite3BtreeGetAutoVacuum(pTemp));
# vacuum.c:     sqlite3BtreeSetAutoVacuum(pMain, sqlite3BtreeGetAutoVacuum(pTemp));
# vacuum.c:   rc = sqlite3BtreeSetPageSize(pMain, sqlite3BtreeGetPageSize(pTemp), nRes,1);
# vacuum.c:   rc = sqlite3BtreeSetPageSize(pMain, sqlite3BtreeGetPageSize(pTemp), nRes,1);
# vacuum.c:   sqlite3BtreeSetPageSize(pMain, -1, -1, 1);
# vacuum.c:     sqlite3BtreeClose(pDb->pBt);
_? vdbe.c:       (isBtreeCursor?sqlite3BtreeCursorSize():0) + 
_? vdbe.c:       sqlite3BtreeCursorZero(pCx->pCursor);
_? vdbe.c:       assert( sqlite3BtreeCursorIsValid(pCrsr) );
_? vdbe.c:       rc = sqlite3BtreeKeySize(pCrsr, &payloadSize64);
_? vdbe.c:       assert( sqlite3BtreeCursorIsValid(pCrsr) );
_ vdbe.c:       rc = sqlite3BtreeDataSize(pCrsr, &payloadSize);
_ vdbe.c:         zData = (char*)sqlite3BtreeKeyFetch(pCrsr, &avail);
_ vdbe.c:         zData = (char*)sqlite3BtreeDataFetch(pCrsr, &avail);
_? vdbe.c:     rc = sqlite3BtreeCount(pCrsr, &nEntry);
_? vdbe.c:           rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);
_ vdbe.c:     rc = sqlite3BtreeBeginTrans(pBt, pOp->p2);
_ vdbe.c:       assert( sqlite3BtreeIsInTrans(pBt) );
_ vdbe.c:       rc = sqlite3BtreeBeginStmt(pBt, p->iStatement);
_ vdbe.c:   sqlite3BtreeGetMeta(db->aDb[iDb].pBt, iCookie, (u32 *)&iMeta);
_ vdbe.c:   rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, (int)pIn3->u.i);
_ vdbe.c:     sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&iMeta);
_? vdbe.c:   rc = sqlite3BtreeCursor(pX, p2, wrFlag, pKeyInfo, pCur->pCursor);
_ vdbe.c:   rc = sqlite3BtreeOpen(0, db, &pCx->pBt, 
_ vdbe.c:     rc = sqlite3BtreeBeginTrans(pCx->pBt, 1);
_ vdbe.c:       rc = sqlite3BtreeCreateTable(pCx->pBt, &pgno, BTREE_BLOBKEY); 
_ vdbe.c:         rc = sqlite3BtreeCursor(pCx->pBt, pgno, 1, 
_ vdbe.c:       rc = sqlite3BtreeCursor(pCx->pBt, MASTER_ROOT, 1, 0, pCx->pCursor);
? vdbe.c:               rc = sqlite3BtreeFirst(pC->pCursor, &res);
? vdbe.c:               rc = sqlite3BtreeLast(pC->pCursor, &res);
? vdbe.c:       rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, 0, (u64)iKey, 0, &res);
? vdbe.c:       rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, &r, 0, 0, &res);
? vdbe.c:         rc = sqlite3BtreeNext(pC->pCursor, &res);
? vdbe.c:         rc = sqlite3BtreePrevious(pC->pCursor, &res);
_? vdbe.c:         res = sqlite3BtreeEof(pC->pCursor);
_ vdbe.c:     rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, pIdxKey, 0, 0, &res);
_ vdbe.c:     rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &pCx->seekResult);
_ vdbe.c:     rc = sqlite3BtreeMovetoUnpacked(pCrsr, 0, iKey, 0, &res);
? vdbe.c:       v = sqlite3BtreeGetCachedRowid(pC->pCursor);
? vdbe.c:         rc = sqlite3BtreeLast(pC->pCursor, &res);
_ vdbe.c:           assert( sqlite3BtreeCursorIsValid(pC->pCursor) );
_ vdbe.c:           rc = sqlite3BtreeKeySize(pC->pCursor, &v);
? vdbe.c:       sqlite3BtreeSetCachedRowid(pC->pCursor, v<MAX_ROWID ? v+1 : 0);
? vdbe.c:       while(   ((rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, 0, (u64)v,
? vdbe.c:   sqlite3BtreeSetCachedRowid(pC->pCursor, 0);
_ vdbe.c:   rc = sqlite3BtreeInsert(pC->pCursor, 0, iKey,
? vdbe.c:   sqlite3BtreeSetCachedRowid(pC->pCursor, 0);
_ vdbe.c:   rc = sqlite3BtreeDelete(pC->pCursor);
_ vdbe.c:   assert( sqlite3BtreeCursorIsValid(pCrsr) );
_ vdbe.c:     rc = sqlite3BtreeKeySize(pCrsr, &n64);
_ vdbe.c:     rc = sqlite3BtreeDataSize(pCrsr, &n);
_ vdbe.c:     rc = sqlite3BtreeKey(pCrsr, 0, n, pOut->z);
_ vdbe.c:     rc = sqlite3BtreeData(pCrsr, 0, n, pOut->z);
_ vdbe.c:       rc = sqlite3BtreeKeySize(pC->pCursor, &v);
? vdbe.c:     sqlite3BtreeClearCursor(pC->pCursor);
? vdbe.c:     rc = sqlite3BtreeLast(pCrsr, &res);
? vdbe.c:     rc = sqlite3BtreeFirst(pCrsr, &res);
_ vdbe.c:   rc = pOp->opcode==OP_Next ? sqlite3BtreeNext(pCrsr, &res) :
_ vdbe.c:                               sqlite3BtreePrevious(pCrsr, &res);
_ vdbe.c:       rc = sqlite3BtreeInsert(pCrsr, zKey, nKey, "", 0, 0, pOp->p3, 
? vdbe.c:     rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res);
_ vdbe.c:       rc = sqlite3BtreeDelete(pCrsr);
_ vdbe.c:     rc = sqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved);
? vdbe.c:   rc = sqlite3BtreeClearTable(
_ vdbe.c:   rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);
_ vdbe.c:   assert( sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );
_ vdbe.c:   sqlite3BtreeEnterAll(db);
_ vdbe.c:   sqlite3BtreeLeaveAll(db);
? vdbe.c:   z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot,
_ vdbe.c:   pPager = sqlite3BtreePager(pBt);
_ vdbe.c:       assert( sqlite3BtreeIsInTrans(pBt)==0 );
_ vdbe.c:         rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));
? vdbe.c:   rc = sqlite3BtreeIncrVacuum(pBt);
_? vdbe.c:     rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock);
? vdbe.c:   pOut->u.i = sqlite3BtreeLastPage(db->aDb[pOp->p1].pBt);
? vdbe.c:     newMax = sqlite3BtreeLastPage(pBt);
_? vdbe.c:   pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax);
_ vdbe.c:   sqlite3BtreeMutexArrayLeave(&p->aMutex);
? vdbeapi.c:       int nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt));
? vdbeaux.c:     sqlite3BtreeMutexArrayInsert(&p->aMutex, p->db->aDb[i].pBt);
_ vdbeaux.c:     sqlite3BtreeClose(pCx->pBt);
_ vdbeaux.c:     sqlite3BtreeCloseCursor(pCx->pCursor);
_ vdbeaux.c:     if( sqlite3BtreeIsInTrans(pBt) ){
_ vdbeaux.c:       rc = sqlite3PagerExclusiveLock(sqlite3BtreePager(pBt));
? vdbeaux.c:   if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(db->aDb[0].pBt))
_ vdbeaux.c:         rc = sqlite3BtreeCommitPhaseOne(pBt, 0);
_ vdbeaux.c:         rc = sqlite3BtreeCommitPhaseTwo(pBt);
? vdbeaux.c:     char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt);
_ vdbeaux.c:       if( sqlite3BtreeIsInTrans(pBt) ){
? vdbeaux.c:         char const *zFile = sqlite3BtreeGetJournalname(pBt);
_? vdbeaux.c:         if( !needSync && !sqlite3BtreeSyncDisabled(pBt) ){
_ vdbeaux.c:         rc = sqlite3BtreeCommitPhaseOne(pBt, zMaster);
_ vdbeaux.c:         sqlite3BtreeCommitPhaseTwo(pBt);
_ vdbeaux.c:     if( p && sqlite3BtreeIsInTrans(p) ){
? vdbeaux.c:       sqlite3BtreeTripAllCursors(p, SQLITE_ABORT);
_ vdbeaux.c:           rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_ROLLBACK, iSavepoint);
_ vdbeaux.c:           rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_RELEASE, iSavepoint);
_ vdbeaux.c:   sqlite3BtreeMutexArrayEnter(&p->aMutex);
_ vdbeaux.c:   sqlite3BtreeEnterAll(p->db);
_ vdbeaux.c:             sqlite3BtreeMutexArrayLeave(&p->aMutex);
_ vdbeaux.c:           sqlite3BtreeMutexArrayLeave(&p->aMutex);
_ vdbeaux.c:     sqlite3BtreeMutexArrayLeave(&p->aMutex);
? vdbeaux.c:     rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res);
? vdbeaux.c:     int rc = sqlite3BtreeCursorHasMoved(p->pCursor, &hasMoved);
_ vdbeaux.c:   assert( sqlite3BtreeCursorIsValid(pCur) );
_ vdbeaux.c:   rc = sqlite3BtreeKeySize(pCur, &nCellKey);
_ vdbeaux.c:   assert( sqlite3BtreeCursorIsValid(pCur) );
_ vdbeaux.c:   rc = sqlite3BtreeKeySize(pCur, &nCellKey);
? vdbeblob.c:       sqlite3BtreeEnterCursor(p->pCsr);
? vdbeblob.c:       sqlite3BtreeCacheOverflow(p->pCsr);
? vdbeblob.c:       sqlite3BtreeLeaveCursor(p->pCsr);
_ vdbeblob.c:     sqlite3BtreeEnterAll(db);
_ vdbeblob.c:       sqlite3BtreeLeaveAll(db);
_ vdbeblob.c:       sqlite3BtreeLeaveAll(db);
_ vdbeblob.c:         sqlite3BtreeLeaveAll(db);
_ vdbeblob.c:     sqlite3BtreeLeaveAll(db);
_ vdbeblob.c:     sqlite3BtreeEnterCursor(p->pCsr);
_ vdbeblob.c:     sqlite3BtreeLeaveCursor(p->pCsr);
? vdbeblob.c:   return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreeData);
? vdbeblob.c:   return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData);
_ vdbemem.c:   assert( sqlite3BtreeCursorIsValid(pCur) );
_ vdbemem.c:     zData = (char *)sqlite3BtreeKeyFetch(pCur, &available);
_ vdbemem.c:     zData = (char *)sqlite3BtreeDataFetch(pCur, &available);
_ vdbemem.c:       rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
_ vdbemem.c:       rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
_ vtab.c:     sqlite3BtreeHoldsMutex(db->aDb[sqlite3SchemaToIndex(db, p->pSchema)].pBt) 
_ vtab.c:   assert( sqlite3BtreeHoldsAllMutexes(db) );
_ analyze.c:   assert( sqlite3BtreeHoldsAllMutexes(db) );
_ analyze.c:   assert( sqlite3BtreeHoldsAllMutexes(db) );
_ analyze.c:   assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
_ analyze.c:   assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
_ analyze.c:   assert( sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );
_ attach.c:   rc = sqlite3BtreeOpen(zFile, db, &aNew->pBt, 0,
_ attach.c:     pPager = sqlite3BtreePager(aNew->pBt);
? attach.c:     sqlite3BtreeSecureDelete(aNew->pBt,
? attach.c:                              sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) );
_ attach.c:     sqlite3BtreeEnterAll(db);
_ attach.c:     sqlite3BtreeLeaveAll(db);
_ attach.c:       sqlite3BtreeClose(db->aDb[iDb].pBt);
_ attach.c:   if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){
_ attach.c:   if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){
_ attach.c:   sqlite3BtreeClose(pDb->pBt);
? alter.c:   assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
? alter.c:   assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
? alter.c:   assert( sqlite3BtreeHoldsAllMutexes(db) );
? alter.c:   assert( sqlite3BtreeHoldsAllMutexes(db) );
 
